home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 June / SGI IRIX Patches 1995 Jun.iso / 5.3_patches / patchSG0000487 / patchSG0000487.idb / usr / include / sys / stropts.h.z / stropts.h
Encoding:
C/C++ Source or Header  |  1995-06-12  |  9.3 KB  |  383 lines

  1. /*    Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_STROPTS_H    /* wrapper symbol for kernel use */
  11. #define _SYS_STROPTS_H    /* subject to change without notice */
  12.  
  13. /*#ident    "@(#)uts-3b2:io/stropts.h    1.8"*/
  14. #ident    "$Revision: 3.12 $"
  15.  
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19.  
  20. #include <sys/types.h>
  21. #ifdef _IRIX_LATER
  22. /*
  23.  * For struct ecb (source compatibility).
  24.  */
  25. #include <sys/evecb.h>
  26. #endif /* _IRIX_LATER */
  27. /* For FMNAMESZ define */
  28. #include <sys/cdefs.h>
  29. #include <sys/conf.h>
  30.  
  31. /*
  32.  * Write options.
  33.  */
  34. #define SNDZERO        0x001        /* send a zero length message */
  35. #define SNDPIPE        0x002        /* send SIGPIPE on write and */
  36.                     /* putmsg if sd_werror is set */
  37. #define SNDHOLD        0x004        /* enable strhold feature */
  38.  
  39. /*
  40.  * Read options
  41.  */
  42.  
  43. #define RNORM        0x000        /* read msg norm */
  44. #define RMSGD        0x001        /* read msg discard */
  45. #define RMSGN        0x002        /* read msg no discard */
  46.  
  47. #define RMODEMASK    0x003        /* all above bits */
  48.  
  49. /*
  50.  * These next three read options are added for the sake of
  51.  * user-level transparency.  RPROTDAT will cause the stream head
  52.  * to treat the contents of M_PROTO and M_PCPROTO message blocks
  53.  * as data.  RPROTDIS will prevent the stream head from failing
  54.  * a read with EBADMSG if an M_PROTO or M_PCPROTO message is on
  55.  * the front of the stream head read queue.  Rather, the protocol
  56.  * blocks will be silently discarded and the data associated with
  57.  * the message (in linked M_DATA blocks), if any, will be delivered
  58.  * to the user.  RPROTNORM sets the default behavior, where read
  59.  * will fail with EBADMSG if an M_PROTO or M_PCPROTO are at the
  60.  * stream head.
  61.  */
  62. #define RPROTDAT    0x004        /* read protocol messages as data */
  63. #define RPROTDIS    0x008        /* discard protocol messages, but */
  64.                     /* read data portion */
  65. #define RPROTNORM    0x010
  66.  
  67. #define RPROTMASK    0x01c        /* all RPROT bits */
  68.  
  69. /*
  70.  * Flush options
  71.  */
  72.  
  73. #define FLUSHR        0x01        /* flush read queue */
  74. #define FLUSHW        0x02        /* flush write queue */
  75. #define FLUSHRW        0x03        /* flush both queues */
  76. #define FLUSHBAND    0x04        /* flush only band specified */
  77.                     /* in next byte */
  78.  
  79. /*
  80.  * Events for which to be sent SIGPOLL signal and for which events
  81.  * can be posted by the I_SETEV ioctl.
  82.  */
  83. #define S_INPUT        0x0001        /* any msg but hipri on read Q */
  84. #define S_HIPRI        0x0002        /* high priority msg on read Q */
  85. #define S_OUTPUT    0x0004        /* write Q no longer full */
  86. #define S_MSG        0x0008        /* signal msg at front of read Q */
  87. #define    S_ERROR        0x0010        /* error msg arrived at stream head */
  88. #define    S_HANGUP    0x0020        /* hangup msg arrived at stream head */
  89. #define S_RDNORM    0x0040        /* normal msg on read Q */
  90. #define S_WRNORM    S_OUTPUT
  91. #define    S_RDBAND    0x0080        /* out of band msg on read Q */
  92. #define S_WRBAND    0x0100        /* can write out of band */
  93. #define S_BANDURG    0x0200        /* modifier to S_RDBAND, to generate */
  94.                     /* SIGURG instead of SIGPOLL */
  95.  
  96. /*
  97.  * Flags for getmsg() and putmsg() syscall arguments.
  98.  * "RS" stands for recv/send.  The system calls were originally called
  99.  * recv() and send(), but were renamed to avoid confusion with the BSD
  100.  * calls of the same name.  A value of zero will cause getmsg() to return
  101.  * the first message on the stream head read queue and putmsg() to send
  102.  * a normal priority message.
  103.  */
  104. #define RS_HIPRI    0x01        /* send/recv high priority message */
  105.  
  106. /*
  107.  * Flags for getpmsg() and putpmsg() syscall arguments.
  108.  */
  109.  
  110. /*
  111.  * These are settable by the user and will be set on return
  112.  * to indicate the priority of message received.
  113.  */
  114. #define MSG_HIPRI    0x01        /* send/recv high priority message */
  115. #define MSG_ANY        0x02        /* recv any messages */
  116. #define MSG_BAND    0x04        /* recv messages from specified band */
  117.  
  118. /*
  119.  * Flags returned as value of getmsg() and getpmsg() syscall.
  120.  */
  121. #define MORECTL        1        /* more ctl info is left in message */
  122. #define MOREDATA    2        /* more data is left in message */
  123.  
  124. /*
  125.  * Define to indicate that all multiplexors beneath a stream should
  126.  * be unlinked.
  127.  */
  128. #define MUXID_ALL    (-1)
  129.  
  130. /*
  131.  * Flag definitions for the I_ATMARK ioctl.
  132.  */
  133. #define ANYMARK        0x01
  134. #define LASTMARK    0x02
  135.  
  136. /*
  137.  *  Stream Ioctl defines
  138.  */
  139. #define    STR        ('S'<<8)
  140. /* (STR|000) in use */
  141. #define I_NREAD        (STR|01)
  142. #define I_PUSH        (STR|02)
  143. #define I_POP        (STR|03)
  144. #define I_LOOK        (STR|04)
  145. #define I_FLUSH        (STR|05)
  146. #define I_SRDOPT    (STR|06)
  147. #define I_GRDOPT    (STR|07)
  148. #define I_STR        (STR|010)
  149. #define I_SETSIG    (STR|011)
  150. #define I_GETSIG    (STR|012)
  151. #define I_FIND        (STR|013)
  152. #define I_LINK        (STR|014)
  153. #define I_UNLINK    (STR|015)
  154. /* (STR|016) in use */
  155. #define I_PEEK        (STR|017)
  156. #define I_FDINSERT    (STR|020)
  157. #define I_SENDFD    (STR|021)
  158. #if defined(_KERNEL)
  159.  
  160. #define I_RECVFD    (STR|022)
  161. #define I_E_RECVFD    (STR|016)
  162.  
  163. #else
  164.  
  165. #define I_RECVFD    (STR|016)    /* maps to kernel I_E_RECVFD */
  166.  
  167.  
  168. #endif /* defined(_KERNEL) */
  169.  
  170. #define I_SWROPT    (STR|023)
  171. #define I_GWROPT    (STR|024)
  172. #define I_LIST        (STR|025)
  173. #define I_PLINK        (STR|026)
  174. #define I_PUNLINK    (STR|027)
  175. #ifdef GEM
  176. #define I_SETEV        (STR|030)
  177. #define I_GETEV        (STR|031)
  178. #define I_STREV        (STR|032)
  179. #define I_UNSTREV    (STR|033)
  180. #endif /* GEM */
  181. #define I_FLUSHBAND    (STR|034)
  182. #define I_CKBAND    (STR|035)
  183. #define I_GETBAND    (STR|036)
  184. #define I_ATMARK    (STR|037)
  185. #define I_SETCLTIME    (STR|040)
  186. #define I_GETCLTIME    (STR|041)
  187. #define I_CANPUT    (STR|042)
  188. #define    I_S_RECVFD    (STR|043)
  189.  
  190. /*
  191.  * User level ioctl format for ioctls that go downstream (I_STR)
  192.  */
  193. struct strioctl {
  194.     int     ic_cmd;            /* command */
  195.     int    ic_timout;        /* timeout value */
  196.     int    ic_len;            /* length of data */
  197.     char    *ic_dp;            /* pointer to data */
  198. };
  199.  
  200. /*
  201.  * Value for timeouts (ioctl, select) that denotes infinity
  202.  */
  203. #define INFTIM        -1
  204.  
  205. /*
  206.  * Stream buffer structure for putmsg and getmsg system calls
  207.  */
  208. struct strbuf {
  209.     int    maxlen;            /* no. of bytes in buffer */
  210.     int    len;            /* no. of bytes returned */
  211.     char    *buf;            /* pointer to data */
  212. };
  213.  
  214. /* 
  215.  * Stream I_PEEK ioctl format
  216.  */
  217. struct strpeek {
  218.     struct strbuf ctlbuf;
  219.     struct strbuf databuf;
  220.     long          flags;
  221. };
  222.  
  223. /*
  224.  * Stream I_FDINSERT ioctl format
  225.  */
  226. struct strfdinsert {
  227.     struct strbuf ctlbuf;
  228.     struct strbuf databuf;
  229.     long          flags;
  230.     int          fildes;
  231.     int          offset;
  232. };
  233.  
  234. /*
  235.  * Receive file descriptor structure
  236.  */
  237.  
  238. #if defined(_KERNEL)
  239.  
  240. struct o_strrecvfd {    /* SVR3 syscall structure */
  241.     union {
  242.         struct file *fp;
  243.         int fd;
  244.     } f;
  245.     o_uid_t uid;        /* always ushort */
  246.     o_gid_t gid;
  247.     char fill[8];
  248. };
  249.  
  250. /* Although EFT is enabled in the kernel we kept the following definition
  251. ** to support an EFT application on a 4.0 non-EFT system.
  252. */
  253.  
  254. struct e_strrecvfd {    /* SVR4 expanded syscall interface structure */
  255.     union {
  256.         struct file *fp;
  257.         int fd;
  258.     } f;
  259.     uid_t uid;        /* always long */
  260.     gid_t gid;
  261.     char fill[8];
  262. };
  263.  
  264. struct strrecvfd {    /* Kernel structure dependent on EFT definition */
  265.     union {
  266.         struct file *fp;
  267.         int fd;
  268.     } f;
  269.     uid_t uid;
  270.     gid_t gid;
  271.     char fill[8];
  272. };
  273.  
  274. #else
  275.  
  276. struct strrecvfd {
  277.     int fd;
  278.     uid_t uid;
  279.     gid_t gid;
  280.     char fill[8];
  281. };
  282.  
  283. #endif    /* defined(_KERNEL) */
  284.  
  285. /*
  286.  * REMIND - I moved this here since secsys.h was purged.
  287.  */
  288. struct sub_attr {
  289.     char kernel_info[1];
  290. };
  291.  
  292. struct s_strrecvfd {
  293.     int fd;
  294.     uid_t uid;
  295.     gid_t gid;
  296.     struct sub_attr s_attrs;
  297. };
  298.  
  299. /*
  300.  * For I_LIST ioctl.
  301.  */
  302. struct str_mlist {
  303.     char l_name[FMNAMESZ+1];
  304. };
  305.  
  306. struct str_list {
  307.     int sl_nmods;
  308.     struct str_mlist *sl_modlist;
  309. };
  310.  
  311. /*
  312.  * For I_STREV and I_UNSTREV ioctls: requesting
  313.  * ET_DRIVER-type events from STREAMS modules and
  314.  * drivers.
  315.  */
  316. #ifdef GEM
  317. struct str_event {
  318.     long        ste_event;    /* the event (module-specific) */
  319.     ecb_t        ste_ecb;    /* event control block */
  320.     long        ste_evflags;    /* same as ev_flags */
  321.     struct strbuf    ste_buf;    /* module-specific data */
  322. };
  323.  
  324. /*
  325.  * For I_SETEV ioctls: requesting ET_STREAM-type
  326.  * events from the stream head.
  327.  */
  328. typedef struct str_sev {
  329.     int    se_mask;    /* generate events for above S_XXX conditions */
  330.     ecb_t    se_ecb;        /* the event control block */
  331.     unchar    se_band;    /* band requested (ignored if does not apply) */
  332. } str_sev_t;
  333.  
  334. /*
  335.  * For I_GETEV ioctls: retrieve the events for
  336.  * which stream head is generating events.
  337.  */
  338. typedef struct str_gev {
  339.     int        ge_flags;    /* see below */
  340.     str_sev_t    *ge_sep;    /* ptr to array of str_sev structs */
  341.     int        ge_ses;        /* number of elements in ge_sep array */
  342. } str_gev_t;
  343.  
  344.  
  345. /*
  346.  * Flags for ge_flags field.
  347.  */
  348. #define    GEF_PROC    0x0001    /* Get information only about    */
  349.                 /* this process' requests.    */
  350.                 /* Otherwise, all I_SETEV's for    */
  351.                 /* the stream head will be    */
  352.                 /* returned.            */
  353. #define    GEF_MORE    0x0002    /* Set on return if there were    */
  354.                 /* more I_SETEVs to return than    */
  355.                 /* would fit into the ge_sep    */
  356.                 /* array the caller provided.    */
  357. #endif /* GEM */
  358. /*
  359.  * For I_FLUSHBAND ioctl.  Describes the priority
  360.  * band for which the operation applies.
  361.  */
  362. struct bandinfo {
  363.     unsigned char    bi_pri;
  364.     int        bi_flag;
  365. };
  366.  
  367. #ifndef _KERNEL
  368. extern int isastream    __P((int));
  369. extern int getmsg    __P((int, struct strbuf *, struct strbuf *, int *));
  370. extern int getpmsg    __P((int, struct strbuf *, struct strbuf *,
  371.                  int *, int *));
  372. extern int putmsg    __P((int, const struct strbuf *, const struct strbuf *,
  373.                  int));
  374. extern int putpmsg    __P((int, const struct strbuf *, const struct strbuf *,
  375.                  int, int));
  376. #endif /* !_KERNEL */
  377.  
  378. #ifdef __cplusplus
  379. }
  380. #endif
  381.  
  382. #endif    /* _SYS_STROPTS_H */
  383.